import request from '@/utils/request'

export function login (data) {
  return request({
    url: '/park/login',
    method: 'post',
    data
  })
}

export function getInfo (token) {
  return request({
    url: '/park/getUserInfo',
    method: 'get',
    params: { token }
  })
}

export function logout () {
  return request({
    url: '/vue-admin-template/user/logout',
    method: 'post'
  })
}
export default {
  getAllUserByPage (queryData) {
    return request({
      url: '/park/user/getUserListByPage',
      method: 'post',
      data: queryData  //转化json传递
    })
  },
  //根据id删除
  deleteById (id) {
    return request({
      url: `/park/user/deleteById?id=${id}`,
      method: 'delete',
    })
  },
  getUserById (id) {
    return request({
      url: `/park/user/getUserById?id=${id}`,
      method: 'get',
    })
  },
  //新增或修改
  addOrEdit (data) {
    return request({
      url: '/park/user/saveSubmit',
      method: 'post',
      data: data  //转化json传递
    })
  },
  //解除禁用 禁用
  invalidOrRecovery (id) {
    return request({
      url: `/park/user/invalidOrRecovery?id=${id}`,
      method: 'post',
    })
  },
}

